<%@ include file="/WEB-INF/views/taglibs.jsp"%>
<html>
<head>
<script type="text/javascript">
	function setProject(selectedProject) {
		document.getElementById("selectedProject").value = selectedProject;
		document.getElementById("projectsForm").submit();
	}
</script>

<style>
.left {
	float: left;
}
</style>
</head>
<body>
	<h3 align="right">
		<a class="logout"
			href="<spring:url value='/j_spring_security_logout' htmlEscape='true' />">Logout</a>
	</h3>
	<h2>The Projector</h2>
	<br />
	<form:form name="projectsForm" id="projectsForm"
		action="projectAssignments">
		<div id="left" class="left">
			<table border="1" bgcolor="skyblue">
				<tr>
					<td>Project Name</td>
					<td>Budget</td>
					<td>Tasks</td>
				</tr>
				
					<c:forEach var="project" items="${projects}">
						<tr>
							<td>${project.name}</td>
							<td>${project.budget}</td>
							<td><a href="#" id="${project.id}"
								onClick="setProject(this.id)">Assignments</a></td>
						</tr>
					</c:forEach>
				<tr>
				<c:if test="${projectSize == 0 }">
						<td colspan="3"> No projects available.</td>
				</c:if>
				</tr>
			</table>
			<input type="hidden" id="selectedProject" name="selectedProject" />
		</div>

	</form:form>
	<form>
		<div id="right" class="right">
			Other Tasks <br /> 
			<a href='<spring:url value="/createProject"/>'>
				Create Project</a> <br /> 
				<a href='<spring:url value="/listPersons"/>'>
				Create Person</a>
		</div>
	</form>

</body>
</html>